"use strict";

const Controller = require("egg").Controller;

class HomeController extends Controller {
  async index() {
    const { ctx } = this;
    ctx.body = "hi, egg";
  }
  async id() {
    const { ctx } = this;
    ctx.body = ctx.params;
  }
  async addName() {
    const { ctx } = this;
    ctx.body = await this.service.user.addName(ctx.params.name);
  }
  async get() {
    const { ctx } = this;
    ctx.body = await this.service.user.get();
  }
  async query() {
    const { ctx } = this;
    ctx.body = ctx.query.name;
  }
  async queries() {
    const { ctx } = this;
    ctx.body = ctx.queries;
  }
  async post() {
    const { ctx } = this;
    ctx.body = ctx.request.body;
  }
}

module.exports = HomeController;
